<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<base href="<%=basePath%>">

<title>我的订单</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<style type="text/css">
#nav {
	height: 100px;
	border-bottom: 3px #FA2486 solid;
	margin-bottom: 1px;
}

#c_nav {
	height: 100px;
	width: 1000px;
	position: relative;
	left: 50%;
	margin-left: -500px;
}

#c_nav div {
	float: left;
}

#main {
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.6);
	display: none;
	position: fixed;
	z-index: 1;
}

#mainn {
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.6);
	display: none;
	position: fixed;
	z-index: 1;
}

#middle {
	display: none;
	height: 150px;
	width: 380px;
	position: relative;
	top: 230px;
	left: 50%;
	margin-left: -170px;
	background: #fff;
}

#middlen {
	display: none;
	height: 150px;
	width: 380px;
	position: relative;
	top: 230px;
	left: 50%;
	margin-left: -170px;
	background: #fff;
}

#del {
	font-size: 24px;
	font-weight: bold;
	color: #999;
	position: relative;
	left: 250px;
	cursor: pointer;
}

#deln {
	font-size: 24px;
	font-weight: bold;
	color: #999;
	position: relative;
	left: 250px;
	cursor: pointer;
}

#content {
	position: relative;
	top: 12px;
}

#confirm {
	height: 30px;
	width: 60px;
	background: #FA2486;
	color: #fff;
	font-size: 13px;
	font-weight: bold;
	border-radius: 3px;
	border: 1px #FA2486 solid;
	cursor: pointer;
	position: relative;
	top: 7px;
}

#contentn {
	position: relative;
	top: 12px;
}

#confirmn {
	height: 30px;
	width: 60px;
	background: #FA2486;
	color: #FA2486;
	font-size: 13px;
	font-weight: bold;
	border-radius: 3px;
	border: 1px #D9D9D9 solid;
	cursor: pointer;
	position: relative;
	top: 7px;
}

#cancel {
	height: 30px;
	width: 60px;
	background: #fff;
	color: #FA2486;
	font-size: 13px;
	font-weight: bold;
	border-radius: 3px;
	border: 1px #D9D9D9 solid;
	cursor: pointer;
	position: relative;
	top: 7px;
	left: 5px;
}

#cancelln {
	height: 30px;
	width: 60px;
	background: #fff;
	color: #3C3C3C;
	font-size: 13px;
	font-weight: bold;
	border-radius: 3px;
	border: 1px #D9D9D9 solid;
	cursor: pointer;
	position: relative;
	top: 7px;
	left: 5px;
}

#search {
	width: 700px;
	position: relative;
	left: 150px;
}

#in {
	height: 40px;
	width: 500px;
	position: relative;
	top: 27px;
	border-radius: 6px;
	border: 1px #DBDBDB solid;
	font-size: 20px;
}

#su {
	height: 40px;
	width: 120px;
	background: #FA2486;
	font-size: 18px;
	color: #fff;
	font-weight: bold;
	position: relative;
	top: 27px;
	border-radius: 6px;
	border: 1px #FA2486 solid;
	cursor: pointer;
}
/***************内容部分样式***************/
#con {
	height: 1000px;

}

#c_con {
	width: 1000px;
	position: relative;
	left: 50%;
	margin-left: -500px;
	height: 1000px;
}

#left {
	width: 150px;
}

#right {
	width: 1000px;
	position: relative;
	top: 10px;
}

#left, #right {
	float: left;
}

#left ul li {
	list-style: none;
	height: 40px;
}

#left span {
	font-size: 16px;
	color: #FA2486;
}

#left span, #left a {
	position: relative;
	top: 10px;
}

#left a:VISITED, #left a:LINK {
	text-decoration: none;
	color: #333;
}

#left a:HOVER {
	text-decoration: underline;
	color: #FA2486;
}

#right_d1 {
	height: 60px;
	background: #FA2486;
	border: 1px #E4EAEE solid;
}

#right_d1 span {
	font-size: 14px;
	position: relative;
	top: 20px;
	left: 30px;
}

#right_d2 {
	height: 50px;
	border-bottom: 1px #E4EAEE solid;
	border-left: 1px #E4EAEE solid;
	border-right: 1px #E4EAEE solid;
}

#right_d2 a:VISITED, #right_d2 a:LINK {
	text-decoration: none;
	font-size: 14px;
	color: #4B4B4B;
}

#right_d2 a:HOVER {
	text-decoration: underline;
	font-size: 14px;
	color: #FA2486;
	font-weight: bold;
}

#right_d2 li {
	list-style: none;
	float: left;
	width: 140px;
	text-align: center;
	position: relative;
	top: 15px;
}

.right_d2_li {
	border-right: 1px #E4EAEE solid;
}

#right_d2 li span {
	color: #FA2486;
}
/************订单部分样式***********/
#in1{
			height: 30px;
			width: 450px;
			position: relative;
			top: 20px;
			border-radius: 6px;
			border:0px;
			font-size: 20px;
		}
		#su1{
			height: 30px;
			width: 110px;
			background: #FCD239 ;
			font-size: 16px;
			color: #fff;
			font-weight: bold;
			position: relative;
			top: 20px;
			border-radius: 6px;
			border: 1px #FCD239  solid;
			cursor: pointer;
		}
#right_d1 span , #search1 {
			float: left;
		}
#search1 {
		    top:10px
			width: 600px;
			position: relative;
			left:105px;  
		    position: relative;
		}
#right_d3 {
	clear: both;
	margin-top: 20px;
}

#right_d3_head, .right_d3_con {
	height: 40px;
	background: #F5F5F5;
	border: 1px #E4EAEE solid;
}

#right_d3_head ul li, .right_d3_con ul li, .right_d3_pro_right ul li {
	list-style: none;
	float: left;
	text-align: center;
}

#right_d3_head ul li span, .right_d3_con ul li span, .right_d3_con ul li a
	{
	position: relative;
	top: 12px;
	color: #3C3C3C;
}

.right_d3_li1 {
	width: 330px;
}

.right_d3_li2, .right_d3_li3 {
	width: 80px;
}

.right_d3_li4, .right_d3_li6 {
	width: 120px;
}

.right_d3_li5 {
	width: 110px;
}

.right_d3_con {
	margin-top: 10px;
}

.right_d3_pro {
	border-bottom: 1px #E4EAEE solid;
	border-left: 1px #E4EAEE solid;
	border-right: 1px #E4EAEE solid;
}

.right_d3_pro table td {
	height: 110px;
}

.right_d3_pro_td1 {
	width: 330px;
}

.tr_li1 {
	width: 80px;
	border: 1px #E4EAEE solid;
	text-align: center;
	margin-left: 10px;
}

.tr_li2 {
	width: 200px;
	margin-left: 10px;
	margin-top: 20px;
}

.right_d3_pro_td2, .right_d3_pro_td3 {
	width: 80px;
	text-align: center;
}

.right_d3_pro_td4, .right_d3_pro_td6 {
	width: 120px;
	text-align: center;
	border-left: 1px #E4EAEE solid;
}

.right_d3_pro_td5 {
	width: 110px;
	text-align: center;
	border-left: 1px #E4EAEE solid;
}

.right_d3_pro_td1 ul li {
	list-style: none;
	float: left;
}

.right_d3_pro_td2 ul li {
	list-style: none;
}

.right_d3_pro_td1 a:VISITED, .right_d3_pro_td1 a:LINK {
	text-decoration: none;
	color: #3C3C3C;
}

.right_d3_pro_td1 a:HOVER {
	text-decoration: underline;
	color: #FA2486;
}

.right_d3_pro_td2_s1 {
	color: #9C9C9C;
}

.right_d3_pro_td2_s2 {
	color: #3C3C3C;
}

.right_d3_pro_td3 span, .right_d3_pro_td5 span {
	color: #3C3C3C;
}

.right_d3_pro_td4 span {
	font-size: 14px;
	font-weight: bold;
	color: #FA2486;
}

.right_d3_pro_td6 a:VISITED, .right_d3_pro_td6 a:LINK {
	text-decoration: none;
	color: #3C3C3C;
}

.right_d3_pro_td6 a:HOVER {
	text-decoration: underline;
	color: #FA2486;
}

.foot ul {
	display: flex;
	justify-content: center;
}

.foot ul li {
	display: inline-block;
	padding: 0 20px;
	color: #666;
	font-size: 12px;
	margin-bottom: 10px;
}

.mgj_footer_hostname {
	margin-top: 20px;
	color: hsla(0, 0%, 40%, .7);
	display: flex;
	justify-content: center;
	margin-bottom: 10px;
	font-size: 13px;
}

#logo {
	height: 59px;
	width: 117px;
	background: url("<%=request.getContextPath()%>/img/logo.png") no-repeat;
	position: relative;
	top: -35px;
	left: -80px;
}

#message {
	height: 110px;
	width: 320px;
	position: relative;
	top: 15px;
	left: 50%;
	margin-left: -160px;
}

#message ul li {
	height: 35px;
	width: 320px;
	list-style: none;
}

#delete {
	font-size: 16px;
	font-weight: bold;
	color: #3C3C3C;
}


    a:link { text-decoration: none;color: #3C3C3C} 

    a:active { text-decoration:blink} 

    a:hover { text-decoration:underline;color: red} 

    a:visited { text-decoration: none;color: #3C3C3C}
    *{ margin:0; padding:0; list-style:none;} 
a{ text-decoration:none;} 
a:hover{ text-decoration:none;} 
.tcdPageCode{padding: 15px 20px;text-align: left;color: #ccc;text-align:center;} 
.tcdPageCode a{display: inline-block;color: #428bca;display: inline-block;height: 25px; line-height: 25px; padding: 0 10px;border: 1px solid #ddd; margin: 0 2px;border-radius: 4px;vertical-align: middle;} 
.tcdPageCode a:hover{text-decoration: none;border: 1px solid #428bca;} 
.tcdPageCode span.current{display: inline-block;height: 25px;line-height: 25px;padding: 0 10px;margin: 0 2px;color: #fff;background-color: #428bca; border: 1px solid #428bca;border-radius: 4px;vertical-align: middle;} 
.tcdPageCode span.disabled{ display: inline-block;height: 25px;line-height: 25px;padding: 0 10px;margin: 0 2px; color: #bfbfbf;background: #f2f2f2;border: 1px solid #bfbfbf;border-radius: 4px;vertical-align: middle;} 

    

</style>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/jquery-1.8.3.js"></script>
	<script src="js/jquery.page.js"></script> 
<script type="text/javascript">	
$(function(){

			//删除一条订单事件
$(".delete").click(function() {
		        $("#main").fadeIn();
				$("#middle").fadeIn();
				$("#content").html("确认要删除该订单吗？");	
				var orderid =$(this).attr("id");	
				//弹框单击确定事件
				$("#confirm").click(function(){
			        //ajax删除订单事件
					$.ajax({
					type:"post",
					url:"order/delete",
					data:{cid:orderid, _method:"PUT"},
					success:function(data) {
						if(data == "yes") {						
						window.location.reload();
						}
						else {
							alert("操作失败");
						}	}
						});	
				});
	
						});

		    //取消一条订单事件
			$(".cancel").click(function() {
			    $("#main").fadeIn();
				$("#middle").fadeIn();
				$("#content").html("确认要取消该订单吗？");	
				var orderid =$(this).attr("id");	
				$("#confirm").click(function(){
				   //ajax取消订单事件
		           $.ajax({
					type:"post",
					url:"order/cancel",
					data:{cid:orderid, _method:"PUT"},
					success:function(data) {
						if(data == "yes") {                 
						window.location.reload();
						}
						else {
							alert("操作失败");
						}
					}
				});	
				});	

			});	
 //申请退款订单事件     <a class="tuikuan"  id="${order.id  }"> 
		$(".tuikuan").click(function() {
			    $("#main").fadeIn();
				$("#middle").fadeIn();
				$("#content").html("确认要申请退款吗？");	
				var orderid =$(this).attr("id");	
				
				$("#confirm").click(function(){
				   //ajax取消订单事件
		           $.ajax({
					type:"post",
					url:"order/confirmShopping" ,
					data:{orderid:orderid,status:4 , _method:"PUT"},
					success:function(data) {
						if(data == "yes") {	                 
						window.location.reload();
						}
						else {
							alert("操作失败");
						}
					}
				});	
				});	
			});	 
			
//确认收货
$(".shouhuo").click(function() {
			    $("#main").fadeIn();
				$("#middle").fadeIn();
				$("#content").html("确认已收货吗？");	
				var orderid =$(this).attr("id");	
				
				$("#confirm").click(function(){
				   //ajax取消订单事件
		           $.ajax({
					type:"post",
					url:"order/confirmShopping" ,
					data:{orderid:orderid,status: 6, _method:"PUT"},
					success:function(data) {
						if(data == "yes") {	                 
						window.location.reload();
						}
						else {
							alert("操作失败");
						}
					}
				});	
				});	

			});	 			
			
			
			
			
			//弹框单击取消事件
			$("#cancel").click(function(){
				$("#main").fadeOut();
			});
			//弹框关闭事件
			$("#del").click(function(){
				$("#main").fadeOut();
			});
					//弹框单击取消事件
			$("#canceln").click(function(){
				$("#mainn").fadeOut();
			});
			//弹框关闭事件
			$("#deln").click(function(){
				$("#mainn").fadeOut();
			});
				
});

		  $(".tcdPageCode").createPage({ 
    pageCount:100, 
    current:1, 
    backFn:function(p){ 
    } 
  });
			
			
			
	</script>
</head>

<body>
	<div id="main">
		<div id="middle">
			<div id="message">
				<ul>
					<li><span id="delete">订单操作</span><span id="del">×</span></li>
					<li><span id="content"></span></li>
					<li><input type="button" value="确&nbsp;定" id="confirm">
						<input type="button" value="取&nbsp;消" id="cancel"></li>
				</ul>
			</div>
		</div>
	</div>

	<jsp:include page="../nhead.jsp"></jsp:include>

	<div id="con">
		<div id="c_con">
			<div id="left">
<!-- 				<ul>
					<li><span>全部功能</span></li>
					<li><a href="cart/my_cart">我的购物车</a></li>
					<li><a href="order/my_order">已买到的宝贝</a></li>
					<li><a href="">我的账户</a></li>
					<li><a href="">我的收获地址</a></li>
					<li><a href="">账户设置</a></li>
				</ul> -->
			</div> 
			<div id="right">
		
					<div id="right_d1">
    				<span>我的全部订单</span>
    					<div id="search1">
				    	<form action="order/search" method="post">
				    		<input type="text" name="name" id="in1"  value="${name }" autocomplete="off">
				    		<input type="hidden" name="uid" id="usid" value="${loginUser.id }" />
				    		<input type="submit" value="搜&nbsp;索" id="su1">
				    	</form>
	    			</div>
    				
    			</div>

				<div id="right_d2">
					<ul>
						<li class="right_d2_li"><a href="order/my_order/0">所有订单</a></li>
						<li class="right_d2_li"><a href="order/my_order/1">待付款</a>&nbsp;<span><c:if
									test="${waitPay!=0 }">	${waitPay }</c:if> </span></li>
						<li class="right_d2_li"><a href="order/my_order/2">待发货</a>&nbsp;<span><c:if
									test="${waitSend!=0 }">	${waitSend }</c:if></span></li>
						<li class="right_d2_li"><a href="order/my_order/3">待收货</a>&nbsp;<span><c:if
									test="${waitConfirm!=0 }">	${waitConfirm }</c:if></span></li>
						<li class="right_d2_li"><a href="order/my_order/4">退款中</a>&nbsp;<span>${refund }</span></li>
						<li class="right_d2_li"><a href="order/my_order/5">退款完成</a>&nbsp;<span>${refundSuccess }</span></li>
						<li class="right_d2_li"><a href="order/my_order/6">订单完成</a>&nbsp;<span>${orderSuccess }</span></li>
					</ul>
				</div>
				<div id="right_d3">
					<div id="right_d3_head">
						<ul>
							<li class="right_d3_li1"><span>商品信息</span></li>
							<li class="right_d3_li2"><span>单价</span></li>
							<li class="right_d3_li3"><span>数量</span></li>
							<li class="right_d3_li4"><span>实付款</span></li>
							<li class="right_d3_li5"><span>交易状态</span></li>
							<li class="right_d3_li6"><span>交易操作</span></li>
						</ul>
					</div>
					<c:forEach items="${orders }" var="order">
						<div class="right_d3_con">
							<ul>
								<li class="right_d3_li1"><span>${order.date }</span></li>
								<li class="right_d3_li2"><span>&nbsp;</span></li>
								<li class="right_d3_li3"><span>&nbsp;</span></li>
								<li class="right_d3_li4"><span>&nbsp;</span></li>
								<li class="right_d3_li5"><span>&nbsp;</span></li>
								<li class="right_d3_li6"><c:if test="${order.status eq 6 }">
										<a class="delete" id="${order.id }">删除</a>
										<li><span id="content"></span></li>
									</c:if>
							</ul>
						</div>
						<div class="right_d3_pro">
							<c:forEach items="${order.orderProducts }" var="orderProduct"
								varStatus="i">
								<table width="845" cellpadding="0" cellspacing="0">
									<tr>
										<td class="right_d3_pro_td1">
											<ul>
												<li class="tr_li1"><a href=""><img
														src="<%=request.getContextPath()%>/image/${orderProduct.product.imgs[0].name}"
														height="80px"></a></li>
												<li class="tr_li2"><a href="">${orderProduct.product.name }${orderProduct.product.describe }</a></li>
											</ul>
										</td>
										<td class="right_d3_pro_td2">
											<ul>
												<li><span class="right_d3_pro_td2_s1"><del>￥${orderProduct.product.price }</del></span></li>
												<li><span class="right_d3_pro_td2_s2">￥<fmt:formatNumber
															type="number"
															value="${orderProduct.product.price * orderProduct.product.discount }"></fmt:formatNumber></span></li>
											</ul>
										</td>
										<td class="right_d3_pro_td3"><span>${orderProduct.quantity }</span>
										</td>
										<td class="right_d3_pro_td4"><c:if
												test="${i.index eq 0 }">
												<span>￥${order.price }</span>
											</c:if></td>
										<td class="right_d3_pro_td5"><c:if
												test="${i.index eq 0 }">
												<c:if test="${order.status eq 1 }">
													<span style="color: #f00">未付款</span>
													<br>
													<br>
												<span><a   href="order/orderdeatil/${order.id}">订单详情</a></span>
												</c:if>
												<c:if test="${order.status eq 2 }">
													<span>等待发货</span>

													<br>
													<br>

												<span><a   href="order/orderdeatil/${order.id}">订单详情</a></span>

												</c:if>
												<c:if test="${order.status eq 3 }">
													<span>卖家已发货</span>
													<br>
													<br>
												<span><a  href="order/orderdeatil/${order.id}">订单详情</a></span>
												</c:if>
												<c:if test="${order.status eq 4 }">
													<span>退款处理中</span>
													<br>
													<br>
												<span><a   href="order/orderdeatil/${order.id}">订单详情</a></span>
												</c:if>
												<c:if test="${order.status eq 5 }">
													<span>卖家已退款</span>
													<br>
													<br>
													<span><a   href="order/orderdeatil/${order.id}">订单详情</a></span>
												</c:if>
												<c:if test="${order.status eq 6 }">
													<span>订单完成</span>
													<br>
													<br>
													<span><a  href="order/orderdeatil/${order.id}">订单详情</a></span>
												</c:if>
												<c:if test="${order.status eq 7 }">
													<span>交易关闭</span>
													<br>
													<br>
													<span><a href="order/orderdeatil/${order.id}">订单详情</a></span>
												</c:if>
											</c:if></td>
										<td class="right_d3_pro_td6"><c:if
												test="${i.index eq 0 }">
												<c:if test="${order.status eq 1 }">
													<a href="order/paynow/${order.id }">立即付款</a>
													<br>
													<br>
													<a class="cancel" id="${order.id }">取消订单</a>

												</c:if>

												<c:if test="${order.status eq 2 }">

													 <a class="tuikuan"  id="${order.id  }"> 
													申请退款</a>

												</c:if>

												<c:if test="${order.status eq 3 }">
													<a class="shouhuo"  id="${order.id  }"> 确认收货</a>

												</c:if>
												<c:if test="${order.status eq 5 }">
													<%-- <a class="cancel" id="${order.id }">确认退款</a> --%>
												</c:if>
											</c:if></td>
									</tr>
								</table>
							</c:forEach>
						</div>
					</c:forEach>
				
					
				</div>
			</div>
		</div>
		<div class="foot">
			<div>
				<ul>
					<li>关于我们</li>
					<li>|</li>
					<li>联系我们</li>
					<li>|</li>
					<li>管理员入口</li>
					<li>意见反馈</li>
					<li>|</li>
					<li>规则中心</li>
					<li>|</li>
					<li>基本信息</li>
					<li>|</li>
					<li>特色产品</li>
				</ul>
			</div>

			<div class="mgj_footer_hostname">
				<span>————————————————————————————————————————&ensp;&ensp;&ensp;&ensp;©2019
					dqz.com
					大民主&ensp;&ensp;&ensp;&ensp;————————————————————————————————————————</span>
			</div>
		</div>
	</div>


</body>
</html>
